import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/Home.vue'),
      redirect: '/home/DailyReport',
      meta: { order: 0 },
      children: [
        {
          path: 'DailyReport',
          name: 'DailyReport',
          component: () => import('@/views/homeChild/DailyReport.vue'),
          meta: { order: 1 }
        },
        {
          path: 'Recommend',
          name: 'Recommend',
          component: () => import('@/views/homeChild/Recommend.vue'),
          meta: { order: 0 }
        }
      ]
    },
    {
      path: '/community',
      name: 'community',
      component: () => import('@/views/Community.vue'),
      redirect: '/community/Recommend',
      meta: { order: 1 },
      children: [
        {
          path: 'Recommend',
          name: 'CommunityRecommend',
          component: () => import('@/views/communityChild/Recommend.vue'),
          meta: { order: 0 }
        },
        {
          path: 'Follow',
          name: 'CommunityFollow',
          component: () => import('@/views/communityChild/Follow.vue'),
          meta: { order: 1 }
        }
      ]
    },
    {
      path: '/find',
      name: 'find',
      component: () => import('@/views/Find.vue'),
      meta: { order: 2 }
    },
    {
      path: '/my',
      name: 'my',
      component: () => import('@/views/My.vue'),
      meta: { order: 3 }
    },
    {
      path: '/video/:id?',
      name: 'video',
      component: () => import('@/views/video/Video.vue')
    },
    {
      path: '/watch-history',
      name: 'watchHistory',
      component: () => import('@/views/myChild/WatchHistory.vue')
    },
    {
      path: '/favorites',
      name: 'favorites',
      component: () => import('@/views/myChild/Favorites.vue')
    },
    {
      path: '/disclaimer',
      name: 'disclaimer',
      component: () => import('@/views/myChild/Disclaimer.vue')
    },
    {
      path: '/feedback',
      name: 'feedback',
      component: () => import('@/views/myChild/Feedback.vue')
    },
    {
      path: '/my-follow',
      name: 'myFollow',
      component: () => import('@/views/myChild/Follow.vue')
    },
    {
      path: '/rank',
      name: 'rank',
      component: () => import('@/views/findChild/Rank.vue')
    }
  ],
})

export default router
